<!-- 样式 -->
<script type="text/html" template>
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/reset.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/css/home/datailed.css">
    <link rel="stylesheet" href="{{ layui.setter.base }}style/page.css">
</script>
<div class="layui-containner">
    <div class="layui-fluid">
        <div id="view-one"></div>
            <div class="layui-tab" overflow>
            <ul class="layui-tab-title">
                <li class="layui-this" data-lang='RelatedToTheRepairOrde'>相关工单</li>
                <li data-lang="StatusChangeRecord">状态变更记录</li>
                <li data-lang="relatedDocuments">相关文档</li>
                <li data-lang="RelatedSpareParts">关联备品备件</li>
                <li data-lang="SparePartsConsumptionRecord">备品备件消耗记录</li>
                <li data-lang="InformationChangeRecord">信息变更记录</li>
                <li data-lang="EquipmentResume">设备履历</li>
                <li>Scada</li>
                <li data-lang="PleasePurchaseRecord">请采购记录</li>
                <li data-lang="parameterOfApparatus">设备参数</li>
            </ul>
            <div class="layui-tab-content">
                <!-- 相关工单 -->
                <div class="layui-tab-item layui-show">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_one"></table>
                </div>
                <!-- 状态变更记录 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_two"></table>
                </div>
                <!-- 相关文档 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_three" lay-filter="demo"></table>
                </div>
                <!-- 关联备品备件 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_fore"></table>
                </div>
                <!-- 备品备件消耗记录 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_five"></table>
                </div>
                <!-- 信息变更记录 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_six"></table>
                </div>
                <!-- 设备履历 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_seven"></table>
                </div>
                <!-- Scada -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_eight"></table>
                </div>
                <!-- 请采购记录 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_nine"></table>
                </div>
                <!-- 设备参数 -->
                <div class="layui-tab-item">
                    <div class="icon-box layui-btn-containner">
                    </div>
                    <table class="layui-table" id="table_ten"></table>
                </div>
            </div>
        </div>
    </div>
    <script type="text/html" id="list-one">
            <div class="layui-title">
                <div class="layui-title-inner" data-lang="BasicInformationOfEquipment">设备基本信息</div>
                <span class="icon edit-icon row_one"></span>
            </div>
            <ul class="box layui-row">
                <li class="layui-col-md3 layui-col-sm3">
                    <div><span  data-lang="DeviceID">设备ID</span>：{{ d.tcDevId }}</div>
                    <div><span  data-lang="equipmentNumber">设备编号</span>:{{ d.fia01 }}</div>
                    {{#  if(d.fiaacti == 0){ }}
                    <div><span data-lang="DEVStatus">设备状态</span>：一般</div>
                    {{#  } else if(d.fiaacti == 1) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：良好</div>
                    {{#  } else if(d.fiaacti == 2) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：不稳定</div>
                    {{#  } else if(d.fiaacti == 3) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：折旧中</div>
                    {{#  } else if(d.fiaacti == 4) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：外送</div>
                    {{#  } else if(d.fiaacti == 5) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：折毕</div>
                    {{#  } else if(d.fiaacti == 6) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：出售</div>
                    {{#  } else if(d.fiaacti == 7) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：报废</div>
                    {{#  } else if(d.fiaacti == 8) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：折毕再提</div>
                    {{#  } else if(d.fiaacti == 9) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：改良</div>
                    {{#  } else if(d.fiaacti == A) { }}
                    <div><span data-lang="DEVStatus">设备状态</span>：重估</div>
                    {{#  } else if(d.fiaacti == null) { }}
                    <div></div>
                    {{# } }}
                    {{#  if(d.azp02 != null){ }}
                    <div>所属公司：{{ d.azp02 }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                    {{#  if(d.fia011 != null){ }}
                    <div><span data-lang="assetNumber">资产编号</span>：{{ d.fia011 }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                </li>
                <li class="layui-col-md3 layui-col-sm3">
                    {{#  if(d.fia02 != null){ }}
                    <div><span data-lang="devicename">设备名称</span>：{{ d.fia02 }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                    {{#  if(d.fic02 != null){ }}
                    <div><span data-lang="deviceType">设备类型</span>:{{ d.fic02 }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                    {{#  if(d.fii02 != null){ }}
                    <div id="fia011" data-name="{{ d.fii02 }}"><span data-lang="unitType">设备型号</span>:{{ d.fii02 }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                    {{#  if(d.tcSeriesName != null){ }}
                    <div><span data-lang="DEVSeries">设备系列</span>:{{ d.tcSeriesName }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                    {{#  if(d.pmc081 != null){ }}
                    <div><span data-lang="supplier">供应商</span>:{{ d.pmc081 }}</div>
                    {{#  } else{ }}
                   <div></div>
                    {{# } }}
                </li>
                <li class="layui-col-md3 layui-col-sm3">
                    {{#  if(d.fia18 != null){ }}
                    <div>购买日期:{{ d.fia18.slice(0,10) }}</div>
                    {{#  } else{ }}
                   <div>购买日期:</div>
                    {{# } }}
                    {{#  if(d.fia19 != null){ }}
                    <div>启动日期:{{ d.fia19.slice(0,10) }}</div>
                    {{#  } else{ }}
                   <div>启动日期:</div>
                    {{# } }}
                    {{#  if(d.fia20 != null){ }}
                    <div>保修日期:{{ d.fia20.slice(0,10) }}</div>
                    {{#  } else{ }}
                   <div>保修日期:</div>
                    {{# } }}
                    {{#  if(d.tcDevChkdate != null){ }}
                    <div><span data-lang="acceptanceDate">验收日期</span>:{{ d.tcDevChkdate.slice(0,10) }}</div>
                    {{#  } else{ }}
                   <div>验收日期:</div>
                    {{# } }}
                </li>
                <li class="layui-col-md3 layui-col-sm3">
                    <div data-lang="EquipmentPictures">设备图片</div>
                    {{# layui.each(d.paths, function(index, item){ }}
                    <img src="{{ d.host }}{{ item.tcFilePath }}" id="upload-img">
                    {{# }); }}
                </li>
            </ul>
            <div class="layui-fluid">
                <div class="layui-title">
                    <span class="layui-title-inner">设备位置及其相关部门.人员</span>
                </div>
                <ul class="box layui-row">
                    <li class="layui-col-md3 layui-col-sm3">
                        {{#  if(d.tcFtyName != null){ }}
                        <div>所在厂房：{{ d.tcFtyName }}</div>
                        {{#  } else{ }}
                        <div>所在厂房：</div>
                        {{# } }}
                        {{#  if(d.tcFlrName != null){ }}
                        <div>所在楼层：{{ d.tcFlrName }}</div>
                        {{#  } else{ }}
                        <div>所在楼层：</div>
                        {{# } }}
                    </li>
                    <li class="layui-col-md3 layui-col-sm3">
                        {{#  if(d.tcLineName != null || d.tcLineName != null){ }}
                        <div>站别线别：{{ d.tcProcName }}  &nbsp;&nbsp; {{ d.tcLineName }}</div>
                        {{#  } else{ }}
                        <div>站别线别：</div>
                        {{# } }}
                        {{#  if(d.gem02 != null){ }}
                        <div><span data-lang="responsibleDepartment">负责部门</span>：{{ d.gem02 }}</div>
                        {{#  } else{ }}
                        <div>负责部门:</div>
                        {{# } }}
                    </li>
                    <li class="layui-col-md3 layui-col-sm3">
                        {{#  if(d.keeper != null){ }}
                        <div><span data-lang="custodian">保管人</span>：{{ d.keeper }}</div>
                        {{#  } else{ }}
                        <div>保管人:</div>
                        {{# } }}
                        {{#  if(d.mover != null){ }}
                        <div><span data-lang="DEVTransferPersonnel">设备调机人员</span>：{{ d.mover }}</div>
                        {{#  } else{ }}
                        <div>设备调机人员:</div>
                        {{# } }}
                    </li>
                </ul>
            </div>
            <div id='view-fore'></div>
            <div class="layui-fluid">
                <div class="layui-title">
                    <span class="layui-title-inner">设备说明</span>
                    <!-- <span class="icon edit-icon row_one"></span> -->
                </div>
                <ul class="box layui-row">
                    <li class="layui-col-md3 layui-col-sm3">
                        <div>
                            <span data-lang="accuracy">精度</span>:
                            {{#  if(d.tcDevPrecision != null){ }}{{d.tcDevPrecision}} {{#  } else{ }}{{# } }}
                        </div>
                        <div id="view-two"></div>
                        <div id="view-three"></div>
                    </li>
                    <li class="layui-col-md3 layui-col-sm3 layui-form">
                        <div data-lang="safetyInstructions">安全说明:</div>
                        {{#  if(d.fia25 != null){ }}
                        <textarea name="fia25" class="text layui-textarea" disabled>{{d.fia25}}</textarea>
                        {{#  } else{ }}
                        <textarea name="fia25" class="text layui-textarea" disabled></textarea>
                        {{# } }}
                        
                    </li>
                    <li class="layui-col-md3 layui-col-sm3 layui-form">
                        <div data-lang="remark">备注:</div>
                        {{#  if(d.fia22 != null){ }}
                        <textarea name="fia22" class="text layui-textarea" disabled>{{d.fia22}}</textarea>
                        {{#  } else{ }}
                        <textarea name="fia22" class="text layui-textarea" disabled></textarea>
                        {{# } }}
                        
                    </li>
                </ul>
            </div>
            <div class="layui-fluid">
                <div class="layui-title">
                    <span class="layui-title-inner">Scada
                    </span>
                    <!-- <span class="icon edit-icon row_three"></span> -->
                </div>
                <ul class="box layui-row" style="margin-bottom:40px;">
                    <li class="layui-col-md3 layui-col-sm3">
                        {{#  if(d.tcScadaIsonine != null){ }}
                        {{#  if(d.tcScadaIsonine == 'Y'){ }}
                        <div name='{{ d.tcScadaIsonine }}'>是否联机：是</div>
                        {{#  } else if((d.tcScadaIsonine == 'N')) { }}
                        <div name='{{ d.tcScadaIsonine }}'>是否联机：否</div>
                        {{#  } }}  
                        {{#  } else { }}
                        <div>是否联机：</div>
                        {{#  } }}  
                        {{#  if(d.tcScadaDrvtype != null){ }}
                        <div>驱动类型：{{ d.tcScadaDrvtype }}</div>
                        {{#  } else { }}
                        <div>驱动类型：</div>
                        {{#  } }}  
                        {{#  if(d.tcScadaDrvname != null){ }}
                        <div>驱动名称：{{ d.tcScadaDrvname }}</div>
                        {{#  } else { }}
                        <div>驱动名称：</div>
                        {{#  } }} 
                        
                    </li>
                    <li class="layui-col-md3 layui-col-sm3">
                        {{#  if(d.tcScadaIpaddress != null){ }}
                        <div>设备IP：{{ d.tcScadaIpaddress }}</div>
                        {{#  } else { }}
                        <div>设备IP：</div>
                        {{#  } }} 
                        {{#  if(d.tcScadaProdtime != null){ }}
                        <div>正常生产时长：{{ d.tcScadaProdtime }}</div>
                        {{#  } else { }}
                        <div>正常生产时长：</div>
                        {{#  } }} 
                        {{#  if(d.tcScadaProdtime != null){ }}
                        <div>待机时长：{{ d.tcScadaStdbytime }}</div>
                        {{#  } else { }}
                        <div>待机时长：</div>
                        {{#  } }} 
                    </li>
                    <li class="layui-col-md3 layui-col-sm3">
                        {{#  if(d.tcScadaExcptime != null){ }}
                        <div>异常时长：{{ d.tcScadaExcptime }}</div>
                        {{#  } else { }}
                        <div>异常时长：</div>
                        {{#  } }} 
                        {{#  if(d.tcScadaMainttime != null){ }}
                        <div>维修保养时长：{{ d.tcScadaMainttime }}</div>
                        {{#  } else { }}
                        <div>维修保养时长：</div>
                        {{#  } }} 
                        {{#  if(d.tcScadaProduction != null){ }}
                        <div>产量：{{ d.tcScadaProduction }}</div>
                        {{#  } else { }}
                        <div>产量：</div>
                        {{#  } }} 
                    </li>
                </ul>
            </div>
    </script>

    <script type="text/html" id="list-fore">
            <div class="layui-fluid">
                <div class="layui-title">
                    <span class="layui-title-inner">相关参数
                    </span>
                </div>
                <ul class="box layui-row">
                    {{#  if(d.list == null){ }}
                    <li class="layui-col-md3 layui-col-sm3">
                        <div></div>
                    </li>
                    {{#  } else { }}
                    {{# layui.each(d.list, function(index, item){ }}
                    {{#  if(this.tcParValue != null){ }}
                    <li class="layui-col-md3 layui-col-sm3">
                        <div>{{ this.tcParName }}: {{ this.tcParValue }} {{ this.tcParUnit }}</div>
                    </li>
                    {{#  } else { }}
                    <li class="layui-col-md3 layui-col-sm3">
                        <div></div>
                    </li>
                    {{#  } }} 
                    {{# }); }}
                    <li class="layui-col-md3 layui-col-sm3">
                        <div></div>
                    </li>
                    {{#  } }} 
                </ul>
            </div>
    </script>
    <script type="text/html" id="typeTpl">
            {{#  if(d.fil04 == 'WX' ){ }}
            <div>设备维修工单</div>
            {{#  } else if(d.type == 'BY' ) { }}
            <div>设备保养工单</div>
            {{#  } else if(d.fil04 == 'XJ' ) { }}
            <div>设备巡检计划</div>
            {{#  } else if(d.fil04 == 'DB' ) { }}
            <div>设备调拨工单</div>
            {{#  } else if(d.fil04 == 'BF' ) { }}
            <div>设备报废工单</div>
            {{#  } else if(d.fil04 == 'TY' ) { }}
            <div>设备停用工单</div>
            {{#  } else if(d.fil04 == 'QY' ) { }}
            <div>设备启用工单</div>
            {{#  } else if(d.fil04 == 'BG' ) { }}
            <div>设备信息变更工单</div>
            {{#  } else if(d.fil04 == 'SP' ) { }}
            <div>备品备件借调工单</div>
            {{#  } else if(d.fil04 == 'PD' ) { }}
            <div>设备盘点</div>
            {{#  } }}
        </script>
    <script type="text/html" id="typeTpl_one">
            {{#  if(d.fil05 == 0 ){ }}
            <div>创建/未提交</div>
            {{#  } else if(d.fil05 == 1 ) { }}
            <div>待审核(已提交)</div>
            {{#  } else if(d.fil05 == 2 ) { }}
            <div>待执行(已派单)/未完成</div>
            {{#  } else if(d.fil05 == 3 ) { }}
            <div>外修(维修工单)</div>
            {{#  } else if(d.fil05 == 4 ) { }}
            <div>待确认</div>
            {{#  } else if(d.fil05 == 5 ) { }}
            <div>待领料</div>
            {{#  } else if(d.fil05 == 6 ) { }}
            <div>OA送审中</div>
            {{#  } else if(d.fil05 == 9 ) { }}
            <div>归档/已盘点</div>
            {{#  } }}
        </script>
    <script type="text/html" id="list-two">
            {{#  layui.each(d,function(index, item){ }}
                <div>机台能力：{{item.tcCapName}}</div>
            {{#  }); }}
        </script>
    <script type="text/html" id="list-three">
            {{#  layui.each(d,function(index,item){ }}
                <div>生产能力：{{item.tcProdName}}</div>
            {{#  }); }}
        </script>
    <script type="text/html" id="down">
        <span class="table-eys" lay-event="look"></span>
        <span class="table-down" lay-event="Down"></span>
    </script>
    <script>
        layui.use(['table', 'admin', 'laypage', 'jquery', 'laytpl', 'tree', 'form', 'api', 'view', 'laydate', 'setter', 'treeSelect', 'element','utill'], function () {
            var table = layui.table;
            var admin = layui.admin;
            var laypage = layui.laypage;
            var $ = layui.jquery;
            var laytpl = layui.laytpl;
            var tree = layui.tree;
            var form = layui.form;
            var api = layui.api;
            var view = layui.view;
            var laydate = layui.laydate;
            var setter = layui.setter;
            var utill = layui.utill;
            var treeSelect = layui.treeSelect;
            var element = layui.element;
            var router = layui.router();
            var id = router.search.id;
            var str = sessionStorage.getItem('ipay-merchant')
            var token = JSON.parse(str).token;
            form.render();
            var session = JSON.parse(sessionStorage.getItem('id'));
            var href = JSON.parse(sessionStorage.getItem('layui-this'));
            $(href).addClass('layui-this');
            var id = session.id
            var fia01 = '';
            $('#view-one').on('click', '.row_one', function () {
                var url = "/home/branch-one/detailed-edit";
                $('.edit-icon').attr('lay-href', url);
            })
            // $('#view-one').on('click', '.row_two', function () {
            //     var edit = 2;
            //     sessionStorage.setItem('edit', JSON.stringify(edit));
            //     var url = "/home/branch-one/detailed-edit";
            //     $('.edit-icon').attr('lay-href', url);
            // })
            // $('#view-one').on('click', '.row_three', function () {
            //     var edit = 3;
            //     sessionStorage.setItem('edit', JSON.stringify(edit));
            //     var url = "/home/branch-one/detailed-edit";
            //     $('.edit-icon').attr('lay-href', url);
            // })
            var _TPL = {
                fil04:function(d){
                    if(d.fil04 == 'WX'){
                        return '<span>设备维修工单</span>'
                    }else if(d.fil04 == 'BY'){
                        return '<span>设备保养工单</span>'
                    }else if(d.fil04 == 'XJ'){
                        return '<span>设备巡检工单</span>'
                    }else if(d.fil04 == 'DB'){
                        return '<span>设备调拨工单</span>'
                    }else if(d.fil04 == 'BF'){
                        return '<span>设备报废工单</span>'
                    }else if(d.fil04 == 'TY'){
                        return '<span>设备停用工单</span>'
                    }else if(d.fil04 == 'QY'){
                        return '<span>设备启用工单</span>'
                    }else if(d.fil04 == 'BG'){
                        return '<span>设备变更工单</span>'
                    }else if(d.fil04 == 'SP'){
                        return '<span>备品备件借调工单</span>'
                    }else if(d.fil04 == 'PD'){
                        return '<span>设备盘点</span>'
                    }
                },
                fil05: function (d) {
                if (d.fil05 == 0) {
                    return '<span>创建未提交</span>'
                } else if (d.fil05 == 1) {
                    return '<span>待审核</span>'
                } else if (d.fil05 == 2) {
                    return '<span>待执行</span>'
                } else if (d.fil05 == 3) {
                    return '<span>外修</span>'
                } else if (d.fil05 == 4) {
                    return '<span>待确定</span>'
                } else if (d.fil05 == 5) {
                    return '<span>待领料</span>'
                } else if (d.fil05 == 6) {
                    return '<span>OA送审</span>'
                } else if (d.fil05 == 7) {
                    return '<span>超时未完成</span>'
                } else if (d.fil05 == 8) {
                    return '<span>超时已完成</span>'
                } else if (d.fil05 == 9) {
                    return '<span>归档已盘点</span>'
                }
            }
            }
            //相关工单
            function render_one(data) {
                utill.columnCustom('#table_one', 'FiaEquipOrderVO', {
                    url: api.host + api.xbxq.table1,
                    type:'post',
                    where: {
                        fia01: data
                    },
                    checkbox:false,
                    templet: _TPL,
                });
            }

            //状态变更记录
            function render_two(data) {
                table.render({
                    elem: '#table_two',
                    skin: 'nob',
                    align: 'center',
                    method: 'post',
                    where: {
                        fia011: data
                    },
                    url: api.host + api.xbxq.table2 //数据接口
                    ,
                    contentType: 'application/json',
                    page: {
                        count: 50,
                        limit: 10,
                        layout: ['prev', 'page', 'next', 'skip']
                    },
                    request: {
                        pageName: 'pageNum' //页码的参数名称，默认：page
                        ,
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    response: {
                        statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
                    },
                    parseData: function (res) { //res 即为原始返回的数据
                        return {
                            "code": 200, //解析接口状态
                            "msg": res.message, //解析提示文本
                            "data": res.data.statChgLog.list //解析数据列表
                        };
                    },
                    headers: { 'token': layui.sessionData(setter.tableName).token },
                    cols: [
                        [ {
                            type: 'numbers',
                            title: '序号',
                            align: 'center'
                        }, {
                            field: 'tcLogId',
                            title: '设备状态变更记录ID',
                            align: 'center'
                        }, {
                            field: 'tcLogTime',
                            title: '变更时间',
                            align: 'center'
                        }, {
                            field: 'tcLogStatorig',
                            title: '变更前状态',
                            align: 'center'
                        }, {
                            field: 'tcLogStatalt',
                            title: '变更后状态',
                            align: 'center'
                        }, {
                            field: 'gen02',
                            title: '操作人',
                            align: 'center'
                        }, {
                            field: 'tcLogModby',
                            title: '操作者工号',
                            align: 'center'
                        }]
                    ],
                });
            }
            //相关文档
            function render_three(data) {
                utill.columnCustom('#table_three', 'FiaDocument',{
                    url: api.host + api.xbxq.table3,
                    type:'post',
                    where: {
                        modelid: data,
                    },
                    checkbox:false,
                    toolbar: {
                        toolbar: '#down',
                        title: '操作',
                        event: 'detail',
                        align: 'center'
                    }
                });
            }
            //关联备品备件
            function render_fore(data) {
                utill.columnCustom('#table_fore', "imaFile01", {
                    url: api.host + api.xbxq.table4 //数据接口
                    ,
                    where: {
                        fii02: data
                    },
                    checkbox:false,
                });
            }
            //备品备件消耗记录
            function render_five(data) {
                table.render({
                    elem: '#table_five',
                    skin: 'nob',
                    align: 'center',
                    method: 'post',
                    where: { tcDetailFia01: data },
                    url: api.host + api.xbxq.table5 //数据接口
                    ,
                    contentType: 'application/json',
                    page: {
                        count: 50,
                        limit: 10,
                        layout: ['prev', 'page', 'next', 'skip']
                    },
                    request: {
                        pageName: 'pageNum' //页码的参数名称，默认：page
                        ,
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    response: {
                        statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
                    },
                    parseData: function (res) { //res 即为原始返回的数据
                        return {
                            "code": 200, //解析接口状态
                            "msg": res.message, //解析提示文本
                            "data": res.data.list //解析数据列表
                        };
                    },
                    headers: { 'token': layui.sessionData(setter.tableName).token },
                    cols: [
                        [{
                            type: 'numbers',
                            title: '序号',
                            align: 'center'
                        },{
                            field: 'fil01',
                            title: '相关工单编号',
                            align: 'center'
                        }, {
                            field: 'fiw03',
                            title: '备品备件料件编号',
                            align: 'center'
                        }, {
                            field: 'fiv07',
                            title: '备品备件OA申请人',
                            align: 'center'
                        }, {
                            field: 'gen02',
                            title: '申请人名称',
                            align: 'center'
                        }, {
                            field: 'fim01',
                            title: '相关工单',
                            align: 'center'
                        }, {
                            field: 'fil10',
                            title: '申请时间',
                            align: 'center'
                        }, {
                            field: 'fiw08',
                            title: '数量',
                            align: 'center'
                        }]
                    ],
                });
            }
            //设备信息变更记录
            function render_six(data) {
                table.render({
                    elem: '#table_six',
                    skin: 'nob',
                    align: 'center',
                    method: 'post',
                    where: { fia011: data },
                    url: api.host + api.xbxq.table6 //数据接口
                    ,
                    contentType: 'application/json',
                    page: {
                        count: 50,
                        limit: 10,
                        layout: ['prev', 'page', 'next', 'skip']
                    },
                    request: {
                        pageName: 'pageNum' //页码的参数名称，默认：page
                        ,
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    response: {
                        statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
                    },
                    parseData: function (res) { //res 即为原始返回的数据
                        return {
                            "code": 200, //解析接口状态
                            "msg": res.message, //解析提示文本
                            "data": res.data.infoChgLog.list //解析数据列表
                        };
                    },
                    headers: { 'token': layui.sessionData(setter.tableName).token },
                    cols: [
                        [{
                            type: 'numbers',
                            title: '序号',
                            align: 'center'
                        }, {
                            field: 'tcLogId',
                            title: '设备状态变更记录ID',
                            align: 'center'
                        }, {
                            field: 'tcLogTime',
                            title: '变更时间',
                            align: 'center'
                        }, {
                            field: 'tcLogInfoalt',
                            title: '变更前状态',
                            align: 'center'
                        }, {
                            field: 'tcLogInfoalt',
                            title: '变更后状态',
                            align: 'center'
                        }, {
                            field: 'gen02',
                            title: '操作人',
                            align: 'center'
                        }, {
                            field: 'tcLogModby',
                            title: '操作者工号',
                            align: 'center'
                        }]
                    ],
                });
            }
            //设备履历
            function render_seven(data) {
                table.render({
                    elem: '#table_seven',
                    skin: 'nob',
                    align: 'center',
                    method: 'post',
                    url: api.host + api.xbxq.table7 //数据接口
                    ,
                    where: {
                        tcDetailFia01: data
                    },
                    dataType: 'json',
                    contentType: 'application/json',
                    page: {
                        count: 50,
                        limit: 10,
                        layout: ['prev', 'page', 'next', 'skip']
                    },
                    request: {
                        pageName: 'pageNum' //页码的参数名称，默认：page
                        ,
                        limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    },
                    response: {
                        statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
                    },
                    parseData: function (res) { //res 即为原始返回的数据
                        return {
                            "code": 200, //解析接口状态
                            "msg": res.message, //解析提示文本
                            "data": res.data.list //解析数据列表
                        };
                    },
                    headers: { 'token': layui.sessionData(setter.tableName).token },
                    cols: [
                        [ {
                            type: 'numbers',
                            title: '序号',
                            align: 'center'
                        }, {
                            field: 'azp02',
                            title: '原公司',
                            align: 'center'
                        }, {
                            field: 'azp021',
                            title: '新公司',
                            align: 'center'
                        }, {
                            field: 'fim01',
                            title: '相关工单',
                            align: 'center'
                        }, {
                            field: 'gen02',
                            title: '申请人',
                            align: 'center'
                        }]
                    ],
                });
            }
            //请采购记录
            function render_nine(data) {
                utill.columnCustom('#table_nine', 'FiaPmmAndPmnVo', {
                    url: api.host + api.xbxq.table9,
                    type:'post',
                    checkbox:false,
                    where: { tcDevId: data }
                });
            }
            //设备参数
            function render_ten(data) {
                utill.columnCustom('#table_ten', "FiaFileParametersVO", {
                url: api.host + api.xbxq.table10,
                where: {
                    fia011: data
                }
            });
                // table.render({
                //     elem: '#table_ten',
                //     method: 'post',
                //     url: api.host + api.xbxq.table10 //数据接口
                //     ,
                //     where: {
                //         fia011: data
                //     },
                //     skin: 'nob',
                //     align: 'center',
                //     dataType: 'json',
                //     contentType: 'application/json',
                //     page: {
                //         count: 50,
                //         limit: 10,
                //         layout: ['prev', 'page', 'next', 'skip']
                //     },
                //     request: {
                //         pageName: 'pageNum' //页码的参数名称，默认：page
                //         ,
                //         limitName: 'pageSize' //每页数据量的参数名，默认：limit
                //     },
                //     response: {
                //         statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
                //     },
                //     parseData: function (res) { //res 即为原始返回的数据
                //         return {
                //             "code": 200, //解析接口状态
                //             "msg": res.message, //解析提示文本
                //             "data": res.data.list //解析数据列表
                //         };
                //     },
                //     headers: { 'token': layui.sessionData(setter.tableName).token },
                //     cols: [
                //         [{
                //             type: 'numbers',
                //             title: '序号',
                //             align: 'center'
                //         }, {
                //             field: 'tcParName',
                //             title: '参数名称',
                //             align: 'center'
                //         }, {
                //             field: 'tcParUnit',
                //             title: '参数单位',
                //             align: 'center'
                //         }, {
                //             field: 'tcParValue',
                //             title: '参数值',
                //             align: 'center'
                //         }]
                //     ],
                // });
            }
            table.on("tool(demo)", function (obj) {
                var data = obj.data;
                layui.sessionData("demo", {
                    key: "tableobj",
                    value: data
                });
                var tableobj = layui.sessionData("demo").tableobj;
                switch (obj.event) {
                    case "Down":
                    window.open(
                        api.host + "/do/downloads.json?ids=" + data.tcDocId + '&token=' + token
                    );
                    break;
                    case "look":
                    var htmls = ''
                    for (var i = 0; i < data.tcEamFile.length; i++) {
                        htmls += '<div style="padding: 20px;"><a target="_blank" href="' + api.imghost + '/' + data.tcEamFile[i].tcFileUrl + '" ><p>' + data.tcEamFile[i].tcFileName + data.tcEamFile[i].tcFileType + '</p></a></div>'
                    }
                    layer.open({
                        type: 1
                        , offset: 'auto'
                        , id: 'layerDemo'
                        , content: htmls
                        , btn: '关闭全部'
                        , btnAlign: 'c' //按钮居中
                        , shade: 0 //不显示遮罩
                        , yes: function () {
                        layer.closeAll();
                        }
                    });
                }
            })
            //状态变更记录
            admin.req({
                type: 'get',
                url: api.host + api.xxxx.views_one,
                dataType: 'json',
                contentType: "application/json",
                data: { id },
                success: function (data) {
                    //请求成功时处理
                    var data = data.data;
                    data.host = api.imghost + "/";
                    var fia011 = data.fii02;
                    element.on('tab', function (elem) {
                        if (elem.index == 1) {
                            render_two(id);
                        } else if (elem.index == 2) {
                            return index = data.index;
                        } else if (elem.index == 3) {
                            render_two(id);
                        } else if (elem.index == 4) {

                        } else if (elem.index == 5) {
                            render_six(id);
                        } else if (elem.index == 6) {

                        } else if (elem.index == 7) {
                           
                        } else if (elem.index == 8) {
                            render_nine(id);
                        } else if (elem.index == 9) {

                        }
                    });
                    render_one(data.fia01);
                    render_three(data.tcModelId);
                    render_fore(fia011);
                    render_seven(data.fia01);
                    render_five(data.fia01);
                    render_ten(fia011);
                    laytpl($('#list-one').html()).render(data, function (html) {
                        $('#view-one').html(html);
                    });
                    admin.req({
                        url: api.host + api.xxxx.views_two,
                        type: 'get',
                        dataType: 'json',
                        contentType: "application/json",
                        data: { id },
                        success: function (data) {
                            //请求成功时处理
                            var data = data.data;
                            laytpl($('#list-two').html()).render(data, function (html) {
                                $('#view-two').html(html);

                            });
                            admin.req({
                                url: api.host + api.xxxx.views_fore,
                                type: 'post',
                                dataType: 'json',
                                contentType: 'application/json',
                                data: JSON.stringify({ fia011, pageNum: 0, pageSize: 0 }),
                                success: function (data) {
                                    var data = data.data;
                                    if (data != '') {
                                        laytpl($('#list-fore').html()).render(data, function (html) {
                                            $('#view-fore').html(html);
                                        });
                                    }
                                    admin.req({
                                        url: api.host + api.xxxx.views_three,
                                        type: 'get',
                                        dataType: 'json',
                                        contentType: 'application/json',
                                        data: { id },
                                        success: function (data) {
                                            //请求成功时处理
                                            var data = data.data;
                                            laytpl($('#list-three').html()).render(data, function (html) {
                                                $('#view-three').html(html)


                                            });
                                            utill.showAndHide('#view-one .icon',"FiaFileController:insertFiaFile");
                                        }
                                    });
                                }
                            });

                        }
                    });
                }
            });
           
        });
    </script>
    </body>

    </html>